package com.ebuy.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.ebuy.model.User;

public class ManageInterceptor extends HandlerInterceptorAdapter{

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		User user =(User) request.getSession().getAttribute("user");
		if(user==null){
			response.sendRedirect("/ebuy/user/login");
			return false;
		}
		return true;
	}
   
}
